<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        
        <!-- jquery -->
        <script src="/lianxijs/libs/jquery/jquery-1.11.1.min.js"></script>
        
        <!-- http插件 -->
        <script src="/lianxijs/libs/http/axios.min.js"></script>
        
        <!-- 弹窗插件 -->
        <link rel="stylesheet" type="text/css" href="/lianxijs/libs/sweetalert/sweetalert.css"  />
        <script src="/lianxijs/libs/sweetalert/sweetalert-dev.js"></script>
        
        <!-- 时间格式化插件 -->
        <script src="/lianxijs/libs/moment/moment.min.js"></script>   
        
        <!-- 精确计算插件 -->
        <!-- <script src="/lianxijs/libs/number-precision/index.iife.js"></script> -->
        <script src="/lianxijs/libs/number-precision/index.umd.js"></script>
        
        <!-- 带搜索的下拉框 -->
        <link rel="stylesheet" type="text/css" href="/lianxijs/libs/select2/select2.css"/>
        <script src="/lianxijs/libs/select2/select2.js"></script>
        
        <!-- 日历插件 -->
        <!-- <link rel="stylesheet" type="text/css" href="/lianxijs/libs/jquerydateTime/dateTime.css"/> -->
        <!-- <script src="/lianxijs/libs/jquerydateTime/dateTime.min.js"></script> -->
        
    </head>
    <body>
        <div>
			<form action="/files/文件.txt" method="post" enctype="multipart/form-data">
				<input type="file" name="file" id="file"/>
				<input type="submit" value="提交文件"/>
			</form>
		</div>
		<div>
			<input type="button" value="异步上传" onclick="method();"/>
		</div>
    </body>
</html>
<script>
	function method(){
		console.log($("#file")[0]["files"])
		 var formData = new FormData();

    formData.append("file",$('#file')[0].files[0]);
    

    $.ajax({
        url:'/files/文件.txt',
        dataType:'html',
        type:'POST',
        async: true,//false？
        data: formData,
        processData : false, // 使数据不做处理
        contentType : undefined, // 不要设置Content-Type请求头 undefined false？
        success: function(data){
            console.log(data);
			console.log("111111");
                alert(data);
        },
        error:function(response){
            console.log(response);
			alert("上传失败！");
        }
    });
	}

</script>